// component/m-ver-click.ts
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    height: {
      type: Number,
      value: 80
    },
    // 是否圆角
    radius: {
      type: Boolean,
      value: false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    isClick: false, // 是否点击
    classChoice: false,
    classWare: false,
    classSuccess: false,
    // 圆角大小
    radiusNumber: 0,
  },
  /**
   * 生命周期
   */
  lifetimes: {
    attached() {
      this.setData({
        radiusNumber: this.properties.radius ? this.properties.height/2 : 0
      })
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    check() {
      if(this.data.isClick) {
        return;
      }
      this.setData({isClick: true});
      this.setData({classChoice: true});
      this.setData({classWare: true});
      setTimeout(() => {
        this.setData({classChoice: false});
        this.setData({classWare: false});
        this.triggerEvent('success');
      }, 1000);
      setTimeout(() => {
        this.setData({classSuccess: true});
      }, 700)
    },
    // 重置
    reset() {
      this.setData({isClick: false});
      this.setData({classChoice: false});
      this.setData({classWare: false});
      this.setData({classSuccess: false});
    }
  }
})
